package com.whj.service.impl;

import com.whj.entity.Message;
import com.whj.mapper.MessageDao;
import com.whj.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class MessageServiceImpl implements MessageService {
@Autowired
private MessageDao messageDao;
    @Override
    public List<Message> selectList() {
        return messageDao.selectList( null);
    }

    @Override
    public void addMessage(String ptuserName, String messageText) {
        System.out.println(ptuserName+"  "+messageText);
        Message message = new Message();
        message.setId(null);
        message.setPtuserName(ptuserName);
        message.setMessageText(messageText);
        message.setMessageTime(new Date());
        messageDao.insert(message);
    }
}
